fix: support webpack-dev-server 6.x by dropping SockJS instanceof checks - #1046
Merged
Merged
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
rtm-ctrlz
force-pushed
the
fix/webpack-dev-server-6-sockjs
branch
from
July 24, 2026 23:00
0e0df87 to
257c43a
Compare
|
Thank you guys! |
rtm-ctrlz
force-pushed
the
fix/webpack-dev-server-6-sockjs
branch
2 times, most recently
from
August 6, 2026 11:40
e602458 to
785b4bb
Compare
WDS 6.0.0 removed the SockJSClient module, which broke WDSSocket.js's require() of it with a compile-time "Module not found" error. Detect the active client via duck-typing on `.sock`/`.client` instead of instanceof checks against imported client classes, which works unchanged across WDS 4/5/6 and needs no optional require. Also widen the webpack-dev-server peer range to include 6.x and extend the test harness/CI matrix to cover it.
rtm-ctrlz
force-pushed
the
fix/webpack-dev-server-6-sockjs
branch
from
August 6, 2026 11:44
785b4bb to
5ae4de6
Compare
|
I ran into a CVE against some webpack component, can't remember now. Anyway I made it work with webpack 6 in the mean time. package.json: "overrides": {
"@pmmmwh/react-refresh-webpack-plugin": {
"webpack-dev-server": "^6.0.0"
}
},webpack.config.js resolve: {
alias: {
'webpack-dev-server/client/clients/SockJSClient$': 'webpack-dev-server/client/clients/WebSocketClient.js',
},Probably not wise though. But it cleared the CVE's for the time being until a new release. |
pmmmwh
approved these changes
Aug 13, 2026
Owner
|
Sorry for taking a while with this; will get this released today! |
pmmmwh
enabled auto-merge (squash)
August 13, 2026 11:13
|
@pmmmwh do you need to manually do something to publish a new version of the library with this fix? |
|
@pmmmwh - bumping this, PR is merged but the package hasn't released on npm |
Owner
|
Sorry, I broke automation for publishing. Handling this now! |
AlexSamBY
added a commit
to eisgroup/ui-render
that referenced
this pull request
Sep 30, 2026
…#130) ## The problem, introduced by #128 #128 moved `webpack-dev-server` to 6. `@pmmmwh/react-refresh-webpack-plugin` 0.5.17 declares it as an optional peer only up to 5.x: ``` peerOptional webpack-dev-server@"3.x || 4.x || 5.x" from @pmmmwh/react-refresh-webpack-plugin@0.5.17 ``` `npm ci` installs the lock regardless, which is why #128's and #129's CI stayed green. But every `npm install <package>` since then aborts with `ERESOLVE`. It was found while adding a devDependency for the React 19 leg. ## The fix `@pmmmwh/react-refresh-webpack-plugin` `^0.5.16` → `^0.6.3`. 0.6.3 (2026-08-27) adds `webpack-dev-server` 6.x to that peer range ([#1046](pmmmwh/react-refresh-webpack-plugin#1046) upstream). The one breaking release between them, 0.6.0, raised minimums we already exceed (Node 18.12, webpack 5.2, webpack-dev-server 4.8). It also removed `overlay.sock*` options we never set: the demo uses `new ReactRefreshWebpackPlugin()` with no options. ## Checked - **The install that failed now succeeds**, run as `npm install --dry-run --save-dev <the same packages>`. - **`npm ls --all` reports no invalid peer**, and `npm audit` stays at 0. - **Fast refresh works on the new plugin.** In the running demo (`npm start`), the refresh runtime is injected (`__reactRefreshInjected`). A temporary edit to `NavTabs.jsx`, reverted after, is hot-applied: `[HMR] Updated modules: ./src/demo/components/NavTabs.jsx` and `[HMR] App is up to date.` A marker set on `window` beforehand survives, so the page did not reload. - **The published package is unchanged.** All 282 files `build-lib` publishes are byte-identical to master's; the plugin is demo-only. ## Gates All exited 0: - `lint:js`, `lint:css`, `typecheck`; - `test:env-flags`, `test:coverage`, `build`, `build-lib`; - `test:react16` and `test:react17`, 2907 tests on each; - the manifest contract. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
webpack-dev-server6.0.0 removed the SockJS client, butsockets/WDSSocket.jsstill did a staticrequire('webpack-dev-server/client/clients/SockJSClient')and aninstanceofcheck against it. On WDS 6, that module path no longer resolves, so webpack fails to compile with:client.sock/client.clientinstead ofinstanceofchecks against imported client classes. This removes the need torequire()a module that may not exist, so there's no compile-time warning/error on any supported WDS version, and it works unchanged across WDS 4/5/6.webpack-dev-serverpeer dependency range to^4.8.0 || 5.x || 6.x.webpack-dev-server-v6dev alias,aliasWDSv6.js) and CI matrix to also run against WDS 6.Test plan
yarn lint/yarn format:checkyarn test --testPathIgnorePatterns conformance)yarn test conformance) — all 16 tests pass locally against WDS 4, WDS 5, and WDS 6 (WDS_VERSION=4|5|6)Fixes #1014